<?php require_once('../../core/import.php');?>
<?php
ob_start();
?>
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>中国船舶配套网</title>
        <link>http://www.shipinall.cn/</link>
        <description>Latest 20 articles of all categories</description>
        <copyright>Copyright(C) 中国船舶配套网</copyright>
        <generator>shipinall</generator>
        <lastBuildDate><?php echo date('Y-m-d H:i:s',time()); ?>+0800</lastBuildDate>
        <ttl>10</ttl>
        <image>
            <url>http://www.shipinall.cn/images/ship_logo.gif</url>
            <title>中国船舶配套网</title>
            <link>http://www.shipinall.cn/</link>
        </image>
		<?php
		$Data=DB::GetRows('select * from news where M_IsDelete=FALSE and (ClassID=1 or ClassID=2 or ClassID=3 or ClassID=4) order by ID desc limit 0,20');
		foreach($Data as $Row)
		{
		?>						
        <item>
            <title><?php echo  $Row['Title'];?></title>
            <link>http://news.shipinall.cn/<?php echo $Row['ID'];?>.html</link>
            <description>
                <![CDATA[
                	<?php 
					if($Row['Thumbnail']&&$Row['Thumbnail']!='') 
					{
					?>
						<img src="http://news.shipinall.cn/attachment/news/<?php echo $Row['Thumbnail']; ?>" /><br /><br />
                    <?php
					}
					?>
					<?php
                    $Description=strip_tags($Row['Content']);					
					$Description=trim($Description);
					$Description=trim($Description,'　');
					$Description=trim($Description,'&nbsp;');
					$Description=trim($Description,' ');
					$Description=Functions::SubStr($Description,1200,'..');
					$Description=preg_replace('/\n/','<br/>',$Description);
					echo $Description;
					?>
                    <a href="http://news.shipinall.cn/<?php echo $Row['ID'];?>.html" target="_blank">查看更多</a>
				]]>
            </description>
            <category>
            <?php
            $Data_NewsClass=DB::GetRowByID('news_class',$Row['ClassID']);
			if($Data_NewsClass){
				echo $Data_NewsClass['Name'];
			}
			?>
            </category>
            <author>中国船舶配套网</author>
            <pubDate><?php echo $Row['Datetime']; ?>+0800</pubDate>
        </item>
        <?php
		}
		$Data=NULL;
		?>
    </channel>
</rss>
<?php
$Content=ob_get_clean();
Functions::FWriteFile(ROOT.'/content/rss/news.xml',$Content);
?>